// pages/shop/shop.js
Page({
  data: {
    address: {},
    cart: [],
    allChecked: false,
    totalPrice: 0,
    totalNum: 0
  },
  onShow() { 
    const address = wx.getStorageSync("address")
    const cart = wx.getStorageSync("cart") || [];
   this.setData({ address });
    this.setCart(cart);
  },
  // 点击 收货地址
  async handleChooseAddress() {
    try {
      // 1 获取 权限状态
      const res1 = await getSetting();
      const scopeAddress = res1.authSetting["scope.address"];
      // 2 判断 权限状态
      if (scopeAddress === false) {
        await openSetting();
      }
    } catch (error) {
      console.log(error);
    }
  },
})